Repository navigation
fix(id/web): validate world host-view and invite responses at the fetch boundary (#7833) - #8532
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 9 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
agent-note:v1 |
Fixes #7833.
The world page shape-trusted both of its HTTP responses: a wrong-shape 200 from
/api/world/host-viewor/api/world/invitesurfaced raw engine TypeErrors, rendered bogus per-character records, or persisted a fakeundefinedinvite capability to sessionStorage while reporting success.What changed
pkgs/id/web/src/world-http.tswith fetch-boundary validators in the id(web/image-upload): /api/upload response shape-trusted — a wrong-shape 200 inserts an image node with src undefined into the document #7823parseUploadResponsepattern, with the server contracts inpkgs/id/src/web/world_ws.rsas the oracle:parseWorldHostViewPage— body must be an object,recordsa plain object,records_sequencea finite number,next_aftera string or null,snapshot(when present) must satisfy the same snapshot guard the WebSocket path uses,view/surfacestring/object-or-null. Malformed pages throw the designed "Host view unavailable" vocabulary before any state is touched.parseWorldInviteResponse— body must be an object with a non-empty stringcapability; anything else throws through the "Invite failed" path, soshowCapabilityis never called and nothing is written to sessionStorage.display_namefalls back gracefully (null → the requested name) when absent/wrong-typed.world.tsroutes both fetches through the validators; no other behavior changes.Tests (oracle: the server contracts + the issue's live-probed malformed cases)
world-http.test.ts(new, 19 tests): well-formed controls for both endpoints plus null / {} / array / string bodies, wrong-typedcapability/records/records_sequence/next_after, and guard-failing snapshots.vitest run src/world-http.test.ts src/world-rejoin.test.ts src/world-records.test.ts src/world-contract.test.ts— 53 passed.tsc --noEmitclean.search-panel.test.tsrole=search accessibility) reproduces identically on clean origin/main and is pre-existing, unrelated to this change.Queue: task 14008, lane tmp-code-u.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.